<?
if ($this->blog->GetId())
    $title = 'Редактирование блога';
else
    $title = 'Добавление блога';
?>
<h1><?=$title;?></h1>
<form action="<?=MozgRoute::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'blogs', 'action' => 'save_blog'));?>" method="post">
<table align="center" class="formTable">
	<tr>
		<td class="field-title"><label>Название</label></td>
		<td class="field-place"><input name="title" type="text"
			value="<?=htmlspecialchars($this->blog->GetTitle());?>"></td>
	</tr>
	<tr>
		<td class="field-title"><label>О чём блог</label></td>
		<td class="field-place"><input name="about" type="text"
			value="<?=htmlspecialchars($this->blog->GetAbout());?>"></td>
	</tr>
	<tr>
		<td class="field-title"><label>Краткое описание</label></td>
		<td class="field-place"><textarea name="description" cols="35" rows="3"><?=htmlspecialchars($this->blog->GetDescription());?></textarea></td>
	</tr>	
	<tr>
		<td class="field-title"><label>Логин автора блога</label></td>
		<td class="field-place">
			<div id="userSuggest" class="tagBox">
				<input name="username" id="username" class="tagBoxInput" type="text"
					value="<?=htmlspecialchars($this->blog->GetUserName());?>">
			</div>
		</td>
	</tr>								
</table>
<table>
	<tr>
		<td class="r"><input type="submit" value="Сохранить" class="bt" /></td>
		<td class="l"><input type="button" value="Назад" class="bt"
			onClick="window.location.href='<?=MozgRoute::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'blogs'));?>';" /></td>
	</tr>
</table>
<input type="hidden" name="blog" value="<?=$this->blog->GetId();?>">
</form>
<?=$this->Style()->IncludeStyleFile(array('js' => 'tagdragon'));?>
<script type="text/javascript">
$(document).ready(function() {
	$('#userSuggest').tagdragon({'field':'username',
								 'max':10,
								 'charMin':2,
								 'tagsep':'',
								 'url':'<?=MozgRoute::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'users', 'action' => 'users_list'));?>'});
});
</script>